package org.lex.ftplist.ui;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JDesktopPane;
import javax.swing.JToolBar;

public class MainContentPane extends javax.swing.JPanel {
	private JToolBar toolBar;

	private JDesktopPane desktopPane = null;

	public MainContentPane() {
		initComponents();
	}

	public JDesktopPane getDesktopPane() {
		if (null == desktopPane) {
			desktopPane = new JDesktopPane();
			desktopPane.setName("mainDesktopPane");
			desktopPane.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
		}
		return desktopPane;
	}

	private void initComponents() {
		this.setLayout(new BorderLayout());
		this.add(this.getToolBar(), BorderLayout.NORTH);
		this.add(this.getDesktopPane(), BorderLayout.CENTER);
	}

	private JToolBar getToolBar() {
		if (null == toolBar) {
			toolBar = new JToolBar();
			toolBar.setRollover(true);
			Action test = new AbstractAction() {
				@Override
				public void actionPerformed(ActionEvent e) {
				}
			};
			test.putValue(Action.NAME, "Test");
			toolBar.add(test);
		}
		return toolBar;
	}
}
